package utils

import (
	"strconv"
	"time"
)

func ParserInt8(str interface{}) int64 {
	switch str.(type) {
	case float64:
		return int64(str.(float64))
	case int:
		return int64(str.(int))
	case string:
		result, _ := strconv.Atoi(str.(string))
		return int64(result)
	case int32:
		return int64(str.(int32))
	case int64:
		return int64(str.(int64))
	default:
		return 0
	}
}
func Str2date(str string) time.Time {
	timeLayout := "2006-01-02 15:04:05"  //转化所需模板
	loc, _ := time.LoadLocation("Local") //重要：获取时区
	theTime, _ := time.ParseInLocation(timeLayout, str, loc)
	return theTime
}
